package llama.core;

/**
 * Holds an instance of IClientModel to be accessed statically.
 */
public class ChatModelLocator {
	private static IChatModel chatModel;
	
	public static void setChatModel(IChatModel model) {
		if(chatModel == null) {
			chatModel = model;
		} else if(model == null) {
			chatModel = null;
		} else {
			throw new IllegalStateException("ChatModel has already been set.");
		}
	}
	
	public static IChatModel getChatModel() {
		if(chatModel != null) {
			return chatModel;
		} else {
			throw new IllegalStateException("ChatModel hasn't been set.");
		}
	}
}
